package particleField;

import java.util.*;

import javax.media.opengl.GL;

import processing.core.PApplet;
import processing.opengl.PGraphicsOpenGL;

public class ParticleUpdate implements Runnable{
public static int id = 0;
private int threadID;
private List<Particle> particles;
private boolean running;
private PApplet pa;

ParticleUpdate(PApplet pa, List<Particle> particles){
	threadID = id++;
	this.particles = particles;
	this.pa = pa;
	running = true;
	System.out.println("Thread erstellt mit ID "+threadID);
}
	public void run(){
		while(running){
			
			for(Particle p : particles){
				p.update();
			}
			try {
				Thread.sleep(25);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
}
